package com.project.controller;

import com.project.bean.SaleCarBean;
import com.project.service.ISaleCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("saleCar")
public class SaleCarController {
    @Autowired
    private ISaleCarService service;
@RequestMapping("findByUserId")
    public List<SaleCarBean> findByUserId(Integer userId){
        return service.findByUserId(userId);
    }
@RequestMapping("add")
    public String add(Integer number,Integer userId){
    service.add(number,userId);
    return "ok";
    }
@RequestMapping("del")
    public String del(Integer saleCarId){
    service.del(saleCarId);
    return "ok";
    }
@RequestMapping("update")
    public String update(Integer saleCarId,Integer num){
    service.update(saleCarId,num);
    return "ok";
    }
@RequestMapping("getTotalPrice")
    public Integer getTotalPrice(Integer userId){
    return service.getTotalPrice(userId);
    }
}
